package client;

import server.ServerModel;
import server.ServerTCP;

import javax.swing.*;
import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: Hp
 * Date: 23.04.11
 * Time: 19:12
 * To change this template use File | Settings | File Templates.
 */
public class PaintingFrame extends JFrame {
    public PaintingFrame(){
        super();
        PaintingView view = new PaintingView(), view2 = new PaintingView();
        PaintingModel model = new PaintingModel("Masha", 300, 300), model2 = new PaintingModel("Ivan", 300, 300);
        ServerModel server = new ServerModel(300, 300);

        ServerTCP serverTCP = new ServerTCP();
        serverTCP.setServerModel(server);
        server.setServerInterface(serverTCP);
         serverTCP.start();

        ClientTCP clientTCP = new ClientTCP();
        model.setClientInterface(clientTCP);
        clientTCP.connect();

        ClientTCP clientTCP2 = new ClientTCP();
        model2.setClientInterface(clientTCP2);
        clientTCP2.connect();

        view.setModel(model);
        view2.setModel(model2);
        setSize(630, 330);
        setLayout(new BorderLayout());
        add(view, BorderLayout.EAST);
        add(view2, BorderLayout.WEST);

        //try { Thread.sleep(5000); } catch(InterruptedException ignored) {}

    }

    public static void main(String[] args)
    {
        PaintingFrame frame = new PaintingFrame();
        frame.setVisible(true);
        frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }


}
